<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="common_css :: commonHeader('报表世界基础数据管理')"></head>
<body class="easyui-layout">
<div data-options="region:'west',title:'基础数据',split:true,expand:true" style="width:200px;">
    <div style="margin-left: 5px;">
        <input id="ss" class="easyui-searchbox" style="width:180px"
               data-options="prompt:'搜 索'"/>
        <ul id="treeContent" class="easyui-tree"></ul>
        <div id="nav" class="easyui-menu" style="width:120px;">
            <shiro:hasPermission name="reportworld:database:database:add">
                <div id="1" data-options="iconCls:'icon-add'">添加</div>
            </shiro:hasPermission>
            <shiro:hasPermission name="reportworld:database:database:edit">
                <div id="2" data-options="iconCls:'icon-edit'">修改</div>
            </shiro:hasPermission>
            <shiro:hasPermission name="reportworld:database:database:del">
                <div id="3" data-options="iconCls:'icon-cancel'">移除</div>
            </shiro:hasPermission>
            <shiro:hasPermission name="reportworld:database:manager">
                <div id="4" data-options="iconCls:'icon-redo'">配置管理</div>
            </shiro:hasPermission>
        </div>
    </div>
</div>
<div data-options="region:'center',title:'数据列表'" style="padding:5px">

    <!--搜索框-->
    <form method="post" id="tabfrom">
        <div style="padding:2px" class="easyui-panel" title="数据查询">
            <table class="form-table">
                <tr>
                    <td align="right">所属模块：</td>
                    <td>
                        <input id="strModular" name="strModular" style="width: 350px" multiple="multiple"
                               cascadeCheck="true"
                               data-options="required:false,prompt:'==请选择==',panelHeight:'auto'"
                               class="easyui-combotree"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">所属客户：</td>
                    <td>
                        <input id="strCustomer" name="strCustomer" style="width: 350px" multiple="multiple"
                               cascadeCheck="true"
                               data-options="required:false,prompt:'==请选择=='"
                               class="easyui-combotree"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">所属报表：</td>
                    <td>
                        <input id="strReport" name="strReport" style="width: 350px" multiple="multiple"
                               cascadeCheck="true"
                               data-options="required:false,prompt:'==请选择==',panelHeight:'auto'"
                               class="easyui-combotree"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">状态：</td>
                    <td>
                        <input style="width:150px" id="selRwDbStatus"
                               data-options="valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                               class="easyui-combobox"/>
                    </td>
                </tr>
            </table>
            <table class="form-table" id="showColumn">

            </table>
        </div>
        <br>
    </form>
    <div id="toolbar">
        <shiro:hasPermission name="reportworld:database:insert">
            <a class="easyui-linkbutton" iconCls='icon-add' onclick="insertBasedataInfo();">添加</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="reportworld:database:update">
            <a class="easyui-linkbutton" iconCls='icon-edit' onclick="editBasedataInfo();">修改</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="reportworld:database:del">
            <a class="easyui-linkbutton" iconCls='icon-cancel' onclick="deleteBaseDateById();">删除</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="reportworld:database:batchUpdate">
            <a class="easyui-linkbutton" iconCls='icon-database-table' onclick="dataBaseBatchUpdate();">批量修改</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="reportworld:database:update:info">
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls='icon-cart'
               onclick="getDatabaseUpdateInfo();">修改记录</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="reportworld:database:readFile">
            <a class="easyui-linkbutton" iconCls='icon-chart-curve-edit' onclick="uploadFile.click();">读取数据</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="reportworld:database:sql">
            <a class="easyui-linkbutton" iconCls='icon-date-add' onclick="dataBaseSql();">导出SQL文件</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="reportworld:database:execl">
            <a class="easyui-linkbutton" iconCls='icon-disk' onclick="dataBaseExecl();">导出EXECL文件</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="reportworld:upgradetoolszip">
            <a class="easyui-linkbutton" iconCls='icon-database-table' onclick="downUpgradeToolsZip();">导出ZIP</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="reportworld:database:compareconfig">
            <a class="easyui-linkbutton" iconCls='icon-database-save' onclick="viewCompareconfig();">对比策略</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="reportworld:database:check">
            <a class="easyui-linkbutton" iconCls='icon-door-in' onclick="updateCheckDataBase();">更新校验语句</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="reportworld:database:check:file">
            <a class="easyui-linkbutton" iconCls='icon-disk-upload' onclick="queryCheckDataBaseInfoAll();">导出校验文件</a>
        </shiro:hasPermission>
    </div>
    <div id="dg"></div>
    <input type="hidden" id="databaseCode">
</div>


<div id="dlg" class="easyui-dialog" style="width:800px;height:580px"
     closed="true" modal="true" maximizable="true" resizable="true">
    <form method="post" id="myfromdatabase">
        <table id="databaseview" class="form-table" style="margin-left: 20px;margin-top: 20px">

        </table>
        <table class="form-table" style="margin-left: 20px;margin-top: 20px">
            <tr>
                <td align="right" style="width: 200px">所属模块：</td>
                <td>
                    <input id="updateModular" name="MODULAR" style="width: 350px" multiple="multiple"
                           cascadeCheck="true"
                           data-options="required:false,prompt:'==请选择==',panelHeight:'auto'"
                           class="easyui-combotree" validType="comtreeValidate['updateModular','请选择所属模块']"/>
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 200px">所属客户：</td>
                <td>
                    <input id="updateCustomer" name="CUSTOMER" style="width: 350px" multiple="multiple"
                           cascadeCheck="true"
                           data-options="required:false,prompt:'==请选择=='"
                           class="easyui-combotree" validType="comtreeValidate['updateCustomer','请选择所属客户']"/>
                </td>
            </tr>
            <tr>
                <td align="right" style="width: 200px">所属报表：</td>
                <td>
                    <input id="updateReport" name="REPORT" style="width: 350px" multiple="multiple"
                           cascadeCheck="true"
                           data-options="required:false,prompt:'==请选择==',panelHeight:'auto'"
                           class="easyui-combotree" validType="comtreeValidate['updateReport','请选择所属报表']"/>
                </td>
            </tr>
            <tr id="rwDbVersionTr">
                <td align="right" style="width: 200px">版本号：</td>
                <td>
                    <input style="width:150px" id="rwDbVersion" name="RW_DB_VERSION"
                           data-options="valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                           class="easyui-combobox" validType="comboxValidate['rwDbVersion','请选择版本号']"/>

                </td>
            </tr>
            <tr id="rwDbStatusTr">
                <td align="right" style="width: 200px">状态：</td>
                <td>
                    <input style="width:150px" id="rwDbStatus" name="RW_DB_STATUS"
                           data-options="valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                           class="easyui-combobox" validType="comboxValidate['rwDbStatus','请选择状态']"/>

                </td>
            </tr>
        </table>
    </form>
</div>


<!--修改信息查询-->
<div id="dlgDataDemandBug" class="easyui-dialog" style="width:750px;height:500px"
     closed="true" modal="true" maximizable="true" resizable="true" buttons="#dlg-buttonsUpdateDataSqlInfo">
    <form method="post" id="tabfromDataDemandBug">
    </form>
    <div id="dgDataDemandBug"></div>
    <input type="hidden" id="dataId"> <!--数据ID-->
    <input type="hidden" name="dataCodeView" id="dataCodeView"> <!--数据编码-->
    <div id="dlg-buttonsUpdateDataSqlInfo" style="text-align:center">
        <shiro:hasPermission name="reportworld:database:update:add">
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add"
               onclick="addDataDemandBug()">添加</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="reportworld:database:update:edit">
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit"
               onclick="editDataDemandBug()">修改</a>
        </shiro:hasPermission>
        <shiro:hasPermission name="reportworld:database:update:del">
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel"
               onclick="delDataDemandBug()">删除</a>
        </shiro:hasPermission>
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-back"
           onclick="$('#dlgDataDemandBug').dialog('close')">返回</a>
    </div>
</div>

<!--修改信息查询添加-->
<div id="dlgDataDemandBugView" class="easyui-dialog" style="width:600px;height:510px"
     closed="true" modal="true" maximizable="true" resizable="true">
    <form method="post" id="myformDataDemandBug">
        <div style="padding:20px">
            <table cellpadding="2px" cellspacing="0" class="form-DataSql">
                <input type="hidden" name="id" id="dataDemandBugId"> <!--关联关系表的ID-->
                <input type="hidden" name="dataId" id="dataDemandBugDataId">  <!--数据ID-->
                <input type="hidden" name="dataCode" id="dataCode"> <!--数据编码-->
                <tr>
                    <td align="right">需求/BUG编号：</td>
                    <td colspan="3">
                        <input id="demandBugInfo" ediDataSql="false" name="demandBugId" class="easyui-combobox"
                               data-options="valueField:'id',textField:'demandBugNum' ,prompt:'==请选择=='"
                               validType="checkDataDemandBug['dataDemandBugFirst','已经存在该需求BUG关系，请更换！']"/>
                        <input type="hidden" class="textbox" name="dataDemandBugFirst" id="dataDemandBugFirst"/>
                        <!--之前的-->
                    </td>
                </tr>
                <tr>
                    <td align="right">需求/BUG：</td>
                    <td colspan="3">
                        <input id="demandBugType" name="demandBugType" ediDataSql="false" disabled
                               class="easyui-combobox" data-options="prompt:'==请选择==',panelHeight:'auto', valueField: 'label', textField: 'value',
                                    data: [{ label: '1',  value: '需求' },{ label: '2', value: 'BUG'}]"
                               validType="comboxValidate['demandBugType','请选择需求还是BUG']"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">说明：</td>
                    <td colspan="3">
                        <input class="easyui-textbox" name="description" id="description" disabled
                               missingMessage="请输入说明！"
                               data-options="multiline:true,required:false" style="height:270px;width:350px"/>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>
<div style="display: none;">
    <form id="subFile" enctype="multipart/form-data" method="post">
        <input accept=".xlsx" name="multipartfile" type="file"
               id="uploadFile" onchange="setFilePreview(this.value);">
    </form>
</div>

<div id="dlgMsg" class="easyui-dialog" style="width:600px;height:500px"
     closed="true" modal="true" maximizable="true" resizable="true">
    <input class="easyui-textbox" name="msgInfo" id="msgInfo"
           data-options="multiline:true" style="height:99%;width:99%"/>
</div>

<div id="dlgExp" class="easyui-dialog" style="width:400px;height:300px"
     closed="true" modal="true" maximizable="true" resizable="true">
    <div style="padding:20px">
        <table cellpadding="2px" cellspacing="0" class="form-Database">
            <tr>
                <td>数据库类型：</td>
                <td><input id="dataBaseType"
                           data-options="valueField:'value',textField:'showmsg' ,panelHeight:'auto',prompt:'==请选择=='"
                           class="easyui-combobox"/></td>
            </tr>
        </table>
    </div>
</div>

<!--查看字典页面-->
<div id="dlgDataDicCode" class="easyui-dialog" style="width:900px;height:400px"
     closed="true" modal="true" maximizable="true" resizable="true">
    <div id="dgDataDicCode"></div>
</div>
<div id="dlg-buttonsDataManager" style="text-align:center">
    <shiro:hasPermission name="reportworld:database:manager:save">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-save"
           onclick="saveDataBaseConfig()">保存</a>
    </shiro:hasPermission>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-back"
       onclick="$('#dlgDataManager').dialog('close')">返回</a>
</div>

<!--基础数据配置管理页面-->
<div id="dlgDataManager" class="easyui-dialog" title="基础数据配置管理" style="width:900px;height:600px"
     closed="true" modal="true" maximizable="true" resizable="true" buttons="#dlg-buttonsDataManager">
    <form method="post" id="myformDataManager">
        <div style="padding:20px">
            <table cellpadding="2px" cellspacing="0" class="form-DataSql">
                <input type="hidden" name="databaseId" id="databaseId">
                <input type="hidden" name="code" id="code">
                <input type="hidden" name="id" id="configId">
                <tr>
                    <td align="right">技术主键：</td>
                    <td>
                        <input name="primaryKeyColumnReal" id="primaryKeyColumnReal" class="easyui-combobox"
                               style="width: 350px"
                               data-options="required:false,valueField:'value',textField:'showmsg',panelHeight:'auto',prompt:'==请选择=='"
                               missingMessage="请选择正确技术主键"
                               validType="comboxValidate['primaryKeyColumnReal','请选择正确技术主键']"
                        />
                    </td>
                </tr>
                <tr>
                    <td align="right">业务主键：</td>
                    <td>
                        <input name="onlyColumn" id="onlyColumn" class="easyui-combobox" style="width: 350px"
                               multiple="multiple"
                               data-options="required:true,valueField:'value',textField:'showmsg',prompt:'==请选择=='"
                               missingMessage="请选择正确业务主键字段"
                               validType="comboxValidate['onlyColumn','请选择正确业务主键字段']"
                        />
                    </td>
                </tr>
                <tr>
                    <td align="right">显示字段：</td>
                    <td>
                        <input name="showColumn" id="showColumnConfig" class="easyui-combobox" style="width: 350px"
                               multiple="multiple"
                               data-options="required:true,valueField:'value',textField:'showmsg',prompt:'==请选择=='"
                               missingMessage="请选择正确显示字段"
                               validType="comboxValidate['showColumnConfig','请选择正确显示字段']"
                        />
                    </td>
                </tr>
                <tr>
                    <td align="right">查询字段：</td>
                    <td>
                        <input name="selectColumn" id="selectColumn" class="easyui-combobox" style="width: 350px"
                               multiple="multiple"
                               data-options="required:false,valueField:'value',textField:'showmsg',prompt:'==请选择=='"
                               missingMessage="请选择正确查询条件字段"
                               validType="comboxValidate['selectColumn','请选择正确查询条件字段']"
                        />
                    </td>
                </tr>
                <tr>
                    <td align="right">排序字段：</td>
                    <td>
                        <input name="orderColumn" id="orderColumn" class="easyui-combobox" style="width: 350px"
                               multiple="multiple"
                               data-options="required:false,valueField:'value',textField:'showmsg',prompt:'==请选择=='"
                               missingMessage="请选择正确排序字段"
                               validType="comboxValidate['orderColumn','请选择正确排序字段']"
                        />
                    </td>
                </tr>
                <tr>
                    <td align="right">否区分数库类型：</td>
                    <td>
                        <input name="dataType" editable="false" id="dataType"
                               class="easyui-combobox" data-options="prompt:'==请选择==',panelHeight:'auto', valueField: 'label', textField: 'value',
                                     data: [{ label: '1',  value: '是' },{ label: '2', value: '否'}]"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">状态：</td>
                    <td>
                        <input name="status" id="statusConfig" class="easyui-combobox" editable="false"
                               data-options="required:false,valueField:'value',textField:'showmsg',prompt:'==请选择==',panelHeight:'auto'"
                               missingMessage="请维护状态" validType="comboxValidate['statusConfig','请维护状态']"/>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>

<div id="dlgDataBase" class="easyui-dialog" style="width:650px;height:400px"
     closed="true" modal="true" maximizable="true" resizable="true">
    <form method="post" id="myformDataBase">
        <div style="padding:20px">
            <table cellpadding="2px" cellspacing="0" class="form-table">
                <input type="hidden" name="id">
                <tr>
                    <td align="right">基础数据编码：</td>
                    <td><input name="code" class="easyui-validatebox" style="width: 350px" data-options="required:true"
                               missingMessage="请输入基础数据编码">
                    </td>
                </tr>
                <tr>
                    <td align="right">基础数据名称：</td>
                    <td><input name="name" class="easyui-validatebox" style="width: 350px" data-options="required:true"
                               missingMessage="请输入基础数据名称">
                    </td>
                </tr>
                <tr>
                    <td align="right">顺序：</td>
                    <td><input name="sequence" class="easyui-validatebox" data-options="required:true"
                               missingMessage="请输入字段位数,必须大于0正整数！" validType="integerZero">
                    </td>
                </tr>
                <tr>
                    <td align="right">上级基础数据：</td>
                    <td colspan="3">
                        <input id="parentId" name="parentId" style="width: 350px"
                               data-options="required:true,prompt:'==请选择==',panelHeight:'auto'" class="easyui-combotree"
                               missingMessage="请选择所上级基础数据" validType="comtreeValidate['parentId','请选择上级基础数据']"/></td>
                </tr>
                <tr>
                    <td align="right">基础数据说明：</td>
                    <td colspan="3">
                        <input class="easyui-textbox" name="description"
                               data-options="multiline:true" style="height:80px;width:350px"/>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>


<div id="dlg-buttonsCompareconfig" style="text-align:center">
    <shiro:hasPermission name="reportworld:database:compareconfig:save">
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-save"
           onclick="saveCompareconfig()">保存</a>
    </shiro:hasPermission>
    <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-back"
       onclick="$('#dlgCompareconfig').dialog('close')">返回</a>
</div>

<!--策略信息管理页面-->
<div id="dlgCompareconfig" class="easyui-dialog" title="基础数据配置管理" style="width:850px;height:600px"
     closed="true" modal="true" maximizable="true" resizable="true" buttons="#dlg-buttonsCompareconfig">
    <form method="post" id="myformCompareconfig">
        <div style="padding:20px">
            <table cellpadding="2px" cellspacing="0" class="form-table">
                <input type="hidden" name="id">
                <tr>
                    <td align="right">策略信息：</td>
                    <td colspan="3">
                        <input class="easyui-textbox" name="compareconfig" id="compareconfig"
                               data-options="required:true,multiline:true,validType:['length[10,1200000]','isjson']"
                               style="height:330px;width:650px"/>
                    </td>
                </tr>
                <tr>
                    <td align="right">策略说明信息：</td>
                    <td colspan="3">
                        <input class="easyui-textbox" name="description" id="descriptionCompareconfig"
                               data-options="required:true,multiline:true"
                               validType="length[10,1200000]"
                               style="height:150px;width:650px"/>
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>


<div th:include="common_js :: commJS"></div>
<script type="text/javascript"
        th:src="@{/js/reportworld/dataBase.js}"></script>
<script type="text/javascript"
        th:src="@{/js/reportworld/common.js}"></script>
</body>
</html>
